package com.java.service.Impl;

import com.java.dao.Impl.OrderDaoImpl;
import com.java.dao.OrderDao;
import com.java.entity.Orders;
import com.java.Exception.MyException;
import com.java.service.OrderService;

import java.sql.SQLException;
import java.util.List;

public class OrderServiceImpl implements OrderService {
    private OrderDao orderDao=new OrderDaoImpl();

    /**
    *根据用户Id(身份证)查询订单
     */
    @Override
    public List<Orders> queryOrderById(String Id) throws MyException {
        try {
            List<Orders> orders = orderDao.selectOrderById(Id);
            return orders;
        } catch (SQLException e) {
            e.printStackTrace();
            throw new MyException("查询订单的sql有问题");
        }
    }

    @Override
    public Orders queryOrderByBookId(String bookId) throws MyException {
        Orders orders= null;
        try {
            orders = orderDao.selectOrderByBookId(bookId);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return orders;
    }


}
